package com.cy.cuiyang_admin.controller;

import com.cy.cuiyang_admin.kafka.KafkaProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cuiyang
 * @title: KafkaController
 * @projectName cuiyang_admin
 * @description: TODO
 * @date 2021/1/1920:31
 */
@RestController
@RequestMapping("/kafka")
public class KafkaController {

    private static final Logger logger = LoggerFactory.getLogger(KafkaController.class);

    @Autowired
    private KafkaProducer kafkaProducer;

    @Transactional(rollbackFor = Exception.class)
    @GetMapping("/sendMsg")
    public void sendMsg(){

        kafkaProducer.send("this....is....kafka.....sengMsg....11...");

    }
}
